//
// Created by MikeChen on 2025/3/24.
//

#include "library.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//使用宏定义,宏定义可以在编译时将变量名作为字符串传递，从而达到动态读取变量名的方法
#define PRINT_VAR(var) printf("%s = %d\n",#var,var)

int main(){
    //字符型
    //char 取值范围：-128~127
    //unsigned char 取值范围：0~255
    char val1 = 'a';
    char val2 = '0';
    char val3 = 126;
    char val4 = 128;
    char val5 = 430;
    char val6 = 97;//数字转字符
    unsigned char val7 = 150;

    PRINT_VAR(val1);
    PRINT_VAR(val2);
    PRINT_VAR(val3);//val3 = 126
    PRINT_VAR(val4);//128-256=-128
    PRINT_VAR(val5);//430-256=174-256=-82
//    system("export LANG=en_US.UTF-8 > /dev/null");//超
//    system("export LC_ALL=en_US");
    printf("val6 = %c\n",val6);//val6 = a
    printf("val7 = %c\n",val7);//val7 = �
    printf("char = %d\n",sizeof(char));//char的大小

//    system("chcp 437>>nul");//DOS/windows命令启用美式ASCII码值打印
    system("read -rsp $'Press enter to continue...\\n'");

    return EXIT_SUCCESS;
}